1. Field of the Invention
The present invention relates to a data storage system, a data storing method, and a recording medium for storing the same data in a plurality of storage units.
2. Description of the Related Art
Heretofore, it has been customary for a data storage system to duplicate the same data by storing the data in a plurality of storage units for the purpose of preventing the data from being lost in the event of a system fault.
FIG. 1 of the accompanying drawings shows a data storage system in which data transfer unit 31 receives data from a higher-level device 33 and transfers the received data simultaneously to a plurality of storage units 32a, 32b, so that the same data is stored in the storage units 32a, 32b. Such a data duplicating process is referred to as mirroring. The mirroring performed between hard disks is known as RAID1 (Redundant Arrays of Independent Disks 1, see Non-patent document 1).
Non-patent document 1: David A. Patterson, Garth Gibson, and Randy H. Katz, A Case for Redundant Arrays of Independent Disks (RAID).
Since the mirroring process transfers data simultaneously to a plurality of storage units, it is advantageous in that even when duplicated data are generated, i.e., when both storage units 32a, 32b are available, the time for responding to higher-level device 33 remains the same as when duplicated data not generated, i.e., when only one of storage units 32a, 32b is available.
FIG. 2 of the accompanying drawings shows another data storage system wherein a plurality of data transfer units 41a, 41b and a plurality of storage units 42a, 42b are interconnected by communication network 44. In the data storage system shown in FIG. 2, data transfer units 41a, 41b may attempt to access one storage unit. In such a case, according to the mirroring process for simply transferring data to a plurality of storage units, a data inconsistency may occur between the storage units. For example, such a data inconsistency occurs in a situation shown below.
It is assumed that data transfer unit 41a attempts to write data “a” received from higher-level device 43a and data transfer unit 41b attempts to write data “b” received from higher-level device 43b substantially at the same time in storage units 42a, 42b at the same addresses. In this case, data “a” may arrive at storage unit 42a earlier than data “b” and data “b” may arrive at storage unit 42b earlier than data “a” due to a delay caused by communication network 44. If data “a”, “b” arrive at storage units 42a, 42b at different times, as described above, then since the earlier data is overwritten by the later data, storage unit 42a stores data “b” and storage unit 42b stores data “a”. As a consequence, no data consistency is present between storage units 42a, 42b. 
For a mirroring process to be performed with respect to a plurality of higher-level devices, there is known a process called two-phase locking to be performed for keeping data consistent between storage units (see Non-patent document 2).
Non-patent document 2: “Introductory technical description of database systems—from basics to technical details”, written by Makoto Takizawa, Kabushiki Kaisha Soft Research Center, 1st print on Mar. 1, 1991, p. 188-197
In the system configuration shown in FIG. 2, when data transfer unit 41a is to write data in storage units 42a, 42b, data transfer unit 41a first locks storage unit 42a, so that other data transfer unit 41b cannot write data in storage unit 42a and cannot lock storage unit 42a. Then, data transfer unit 41a first locks storage unit 42b, so that other data transfer unit 41b cannot write data in storage unit 42b and cannot lock storage unit 42b. Thereafter, data transfer unit 41a writes data in storage unit 42a and storage unit 42b. After having written the data in storage unit 42a and storage unit 42b, data transfer unit 41a unlocks storage units 42a, 42b. When data transfer unit 41b is to write data in storage units 42a, 42b, data transfer unit 41b follows the same process as described above.
It is assumed in the two-phase locking process that data transfer unit 41a attempts to write data “a” received from higher-level device 43a and data transfer unit 41b attempts to write data “b” received from higher-level device 43b substantially at the same time in storage units 42a, 42b at the same addresses. Both data transfer units 41a, 41b attempt to lock storage unit 42a. If data transfer unit 41a locks storage unit 42a earlier than data transfer unit 41b, then data transfer unit 41a locks storage unit 42b, writes data “a” in storage units 42a, 42b, and thereafter unlocks storage units 42a, 42b. Data transfer unit 41b is unable to lock storage unit 42a until data transfer unit 42a unlocks storage unit 42a. Consequently, after transfer unit 42a unlocks storage unit 42a, data transfer unit 41b locks storage unit 42a and then locks storage unit 42b, writes data “b” in storage units 42a, 42b, and thereafter unlocks storage units 42a, 42b. Since data “b” is stored in storage units 42a, 42b after data “a” is stored in storage units 42a, 42b, no data inconsistency occurs between storage units 42a, 42b. 
However, the two-phase locking mirroring process is disadvantageous in that it results in a longer response time when data is duplicated than when no data is duplicated because a plurality of storage units need to be locked sequentially.
Another problem of the two-phase locking mirroring process is that since a plurality of storage units need to be locked sequentially, the response time is longer as the number of duplicated data, i.e., the number of storage units, is greater.